<?php
/*$with=400;
$height=100;
$len=5;
$huabu=imagecreatetruecolor($with,$height);
$bag=imagecolorallocate($huabu,250,250,250);
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagefill($huabu,0,0,$bag);
for($i=1;$i<=$with*5;$i++){
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagesetpixel($huabu,mt_rand(0,$with),mt_rand(0,$height),$color);
}
for($i=1;$i<=($with/50);$i++){
 $color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imageline($huabu,mt_rand(0,$with),mt_rand(0,$height),mt_rand(0,$with),mt_rand(0,$height),$color);
}
$rand='';
for($i=0;$i<$len;$i++){
$str="01234546789zxcvbnmasdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIOP";
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagesetpixel($huabu,mt_rand(0,$with),mt_rand(0,$height),$color);
$stry=$str[mt_rand(0,strlen($str)-1)];
$rand.=$stry;
imagettftext($huabu,mt_rand($height/3,$height/1.5),mt_rand(-25,25),100*$i+($with/15),($height/1.5),$color,'./Microsoft+yahei.ttf',$stry);
}
header('Content-type: image/png');
imagepng($huabu);
imagedestroy($huabu);*/
function yzm($len=5){
$with=100*$len;
$height=100;
$huabu=imagecreatetruecolor($with,$height);
$bag=imagecolorallocate($huabu,250,250,250);
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagefill($huabu,0,0,$bag);
for($i=1;$i<=$with*5;$i++){
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagesetpixel($huabu,mt_rand(0,$with),mt_rand(0,$height),$color);
}
for($i=1;$i<=($with/50);$i++){
 $color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imageline($huabu,mt_rand(0,$with),mt_rand(0,$height),mt_rand(0,$with),mt_rand(0,$height),$color);
}
$rand='';
for($i=0;$i<$len;$i++){
$str="01234546789zxcvbnmasdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIOP";
$color=imagecolorallocate($huabu,mt_rand(0,125),mt_rand(0,125),mt_rand(0,125));
imagesetpixel($huabu,mt_rand(0,$with),mt_rand(0,$height),$color);
$stry=$str[mt_rand(0,strlen($str)-1)];
$rand.=$stry;
setcookie('yzm',$rand,time()+60);
imagettftext($huabu,mt_rand($height/3,$height/1.5),mt_rand(-25,25),100*$i+($with/15),($height/1.5),$color,'./Microsoft+yahei.ttf',$stry);
}
header('Content-type: image/png');
imagepng($huabu);
imagedestroy($huabu);
}
?>